﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EditPage.aspx.cs" Inherits="SiteWorx_EditPage" Theme="Admin" StylesheetTheme="Admin"%>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="Csla" Namespace="Csla.Web" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Edit Page Properties</title>

    <script type="text/javascript">
        //This code is used to provide a reference to the radwindow "wrapper"
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz az well)
            return oWindow;
        }

        function CloseOnReload() {
            GetRadWindow().Close();
        }

        function GoToUpdatedPage(page) {
            GetRadWindow().BrowserWindow.location.href = page;
        }
    </script>

</head>
<body>
    <form id="frmEditPage" runat="server">
    <telerik:RadStyleSheetManager ID="rssEditPage" runat="server">
    </telerik:RadStyleSheetManager>
    <telerik:RadScriptManager ID="rsmEditPage" runat="server" EnableTheming="True">
    </telerik:RadScriptManager>
    <telerik:RadFormDecorator ID="rfdEditPage" runat="server" Skin="Telerik" DecoratedControls="CheckBoxes, RadioButtons" />
    <div>
        <telerik:RadAjaxPanel runat="server" ID="rapnlEditPage" HorizontalAlign="NotSet"
            LoadingPanelID="ralEditPage">
            <asp:FormView runat="server" ID="fvEditPage" DefaultMode="Edit" 
                DataSourceID="cdsPage" ondatabound="fvEditPage_DataBound" 
                onitemcommand="fvEditPage_ItemCommand">
                <EditItemTemplate>
                    <table border="0">
                        <tr>
                            <td>
                                <fieldset>
                                    <legend>Page Properties</legend>
                                    <table border="0" width="540" class="form">
                                        <tr>
                                            <td>
                                                *Page title:<br />
                                                <asp:TextBox ID="txtPageTitle" runat="server" Width="438px" MaxLength="256" Text='<%# Bind("Title") %>'></asp:TextBox>
                                                &nbsp;<br />
                                                <asp:RequiredFieldValidator ID="rfvPageTitle" runat="server" 
                                                    ControlToValidate="txtPageTitle" ErrorMessage="Page title is required."></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Page file name:<br />
                                                <asp:Label runat="server" ID="lblPageFileName" Text='<%# Bind("FileName") %>' 
                                                    Font-Bold="True" Font-Italic="True"></asp:Label>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Meta keywords: (ex: stamps, stamp collecting,...)<br />
                                                <asp:TextBox ID="txtMetaKeywords" runat="server" Width="320px" Height="64px" TextMode="MultiLine"
                                                    Text='<%# Bind("MetaKeywords") %>'></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Meta description: (ex: Everything about stamps...)<br />
                                                <asp:TextBox ID="txtMetaDescription" runat="server" Width="320px" Height="64px" TextMode="MultiLine"
                                                    Text='<%# Bind("MetaDescription") %>'></asp:TextBox>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                                <fieldset>
                                    <legend>Menu Properties</legend>
                                    <table border="0" width="530" class="form">
                                        <tr>
                                            <td>
                                                *Menu text:<br />
                                                <asp:TextBox ID="txtMenuTitle" runat="server" Width="160px" MaxLength="32" Text='<%# Bind("MenuText") %>'></asp:TextBox>
                                                &nbsp;<br />
                                                <asp:RequiredFieldValidator ID="rfvMenuTitle" runat="server" ErrorMessage="Menu text is required."
                                                    ControlToValidate="txtMenuTitle"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Menu hover text:<br />
                                                <asp:TextBox ID="txtMenuDescription" runat="server" Width="400px" MaxLength="256"
                                                    Text='<%# Bind("MenuHoverText") %>'></asp:TextBox>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                <asp:CheckBox ID="chkShowInMenu" runat="server" Checked='<%# Bind("DisplayInMenu") %>'
                                                    Text="Display in navigation menu?" Enabled='<%# ((Asah.SiteWorx.SiteMap.Page)Container.DataItem).CanEditDisplayInMenu() %>'>
                                                </asp:CheckBox>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                                <fieldset>
                                    <legend>Layout Properties</legend>
                                    <table border="0" width="530" class="form">
                                        <tr>
                                            <td>
                                                <strong>Select the master layout for this page.</strong>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>
                                                Master Layout:<br />
                                                <telerik:RadComboBox ID="lstLayout" OnLoad="lstLayout_Load" SelectedValue='<%# Bind("MasterPage") %>'
                                                    Enabled='<%# ((Asah.SiteWorx.SiteMap.Page)Container.DataItem).CanEditMasterPage() %>'
                                                    runat="server" Skin="Telerik" NoWrap="true" CausesValidation="false" DropDownWidth="150px"
                                                    Width="150px" AppendDataBoundItems="true">
                                                    <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
                                                    <Items>
                                                    </Items>
                                                </telerik:RadComboBox>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                                <fieldset>
                                    <legend>Page Visibility</legend>
                                    <table border="0" width="530" class="form">
                                        <tr>
                                            <td>
                                                Visibility for this album:<br />
                                                <asp:RadioButtonList runat="server" ID="rbtnlstVisibility" SelectedValue='<%# Bind("Visibility") %>'
                                                    Enabled='<%# ((Asah.SiteWorx.SiteMap.Page)Container.DataItem).CanEditVisibility() %>'>
                                                    <asp:ListItem Value="Public"><span id="public"><span>Public</span></span></asp:ListItem>
                                                    <asp:ListItem Value="Unlisted"><span id="unlisted"><span>Unlisted</span></asp:ListItem>
                                                </asp:RadioButtonList>
                                            </td>
                                        </tr>
                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                        <tfoot>
                            <tr>
                                <td>
                                    <asp:Literal runat="server" ID="litPageUpdateSection"></asp:Literal>
                                </td>
                            </tr>
                        </tfoot>
                    </table>
                    <br />
                    <asp:ValidationSummary runat="server" id="vsumEditPage" />
                    <br />
                    <asp:Button runat="server" ID="btnFinish" Text="Finish" CommandName="Update" />&nbsp;<asp:Button
                        runat="server" ID="btnCancel" Text="Cancel" CausesValidation="False" CommandName="Cancel" />
                </EditItemTemplate>
            </asp:FormView>
        </telerik:RadAjaxPanel>
        <telerik:RadAjaxLoadingPanel ID="ralEditPage" runat="server" Height="75px" Width="75px"
            Style="position: relative; top: -50%; left: 45%;" IsSticky="true">
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
                style="border: 0px;" />
        </telerik:RadAjaxLoadingPanel>
    </div>
    <cc1:CslaDataSource ID="cdsPage" runat="server" TypeAssemblyName="" TypeName="Asah.SiteWorx.SiteMap.Page, Asah"
        TypeSupportsPaging="False" TypeSupportsSorting="False" 
        onselectobject="cdsPage_SelectObject" onupdateobject="cdsPage_UpdateObject">
    </cc1:CslaDataSource>
    </form>
</body>
</html>